package com.linkwings.projectsimple.bean;

import java.util.List;
import java.util.ArrayList;
import java.util.Date;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import com.linkwings.httpconverter.SimpleDateJavaTypeAdapter;
import com.linkwings.httpconverter.XStreamDateValueConverter;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import com.thoughtworks.xstream.annotations.XStreamOmitField;



@XmlRootElement(name = "TestApi")//for jaxb
@XStreamAlias("TestApi")//for xstream
public class TestBean {

	@XStreamAlias("test-name")
	private String name;
	@XStreamOmitField //支持xstream 忽略该字段
	private String password;
	@XStreamConverter(XStreamDateValueConverter.class)
	private Date date;
	private List<String> list =new ArrayList();

	public TestBean(){
		list.add("aaa1");
		list.add("aaa2");
		list.add("aaa3");
	}


	public TestBean(String name, String password, Date date) {
		super();
		this.name = name;
		this.password = password;
		this.date = date;
		list.add("aaa1");
		list.add("aaa2");
		list.add("aaa3");
	}

	@XmlElement(name = "user_name") // changeName
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@XmlTransient //Ignore
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}

	@XmlJavaTypeAdapter(SimpleDateJavaTypeAdapter.class)
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}


	public List<String> getList() {
		return list;
	}


	public void setList(List<String> list) {
		this.list = list;
	}

}
